home *** CD-ROM | disk | FTP | other *** search
/ Halting the Hacker - A P…uide to Computer Security / Halting the Hacker - A Practical Guide to Computer Security.iso / rfc / rfc1476.txt < prev    next >
Text File  |  1997-04-01  |  46KB  |  1,123 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                                        R. Ullmann
  8. Request for Comments: 1476                 Process Software Corporation
  9.                                                               June 1993
  10.  
  11.  
  12.                   RAP: Internet Route Access Protocol
  13.  
  14. Status of this Memo
  15.  
  16.    This memo defines an Experimental Protocol for the Internet
  17.    community.  It does not specify an Internet standard.  Discussion and
  18.    suggestions for improvement are requested.  Please refer to the
  19.    current edition of the "IAB Official Protocol Standards" for the
  20.    standardization state and status of this protocol.  Distribution of
  21.    this memo is unlimited.
  22.  
  23. Abstract
  24.  
  25.    This RFC describes an open distance vector routing protocol for use
  26.    at all levels of the internet, from isolated LANs to the major
  27.    routers of an international commercial network provider.
  28.  
  29. Table of Contents
  30.  
  31.    1.       Introduction  . . . . . . . . . . . . . . . . . . . 2
  32.    1.1       Link-State and Distance-Vector . . . . . . . . . . 3
  33.    1.2       Terminology  . . . . . . . . . . . . . . . . . . . 3
  34.    1.3       Philosophy . . . . . . . . . . . . . . . . . . . . 3
  35.    2.       RAP Protocol  . . . . . . . . . . . . . . . . . . . 4
  36.    2.1       Command Header Format  . . . . . . . . . . . . . . 4
  37.    2.1.1     Length field . . . . . . . . . . . . . . . . . . . 4
  38.    2.1.2     RAP version  . . . . . . . . . . . . . . . . . . . 5
  39.    2.2       RAP Commands . . . . . . . . . . . . . . . . . . . 5
  40.    2.2.1     No operation . . . . . . . . . . . . . . . . . . . 5
  41.    2.2.2     Poll . . . . . . . . . . . . . . . . . . . . . . . 6
  42.    2.2.3     Error  . . . . . . . . . . . . . . . . . . . . . . 7
  43.    2.2.4     Add Route  . . . . . . . . . . . . . . . . . . . . 8
  44.    2.2.5     Purge Route  . . . . . . . . . . . . . . . . . . . 9
  45.    3.       Attributes of Routes  . . . . . . . . . . . . . . . 9
  46.    3.1       Metric and Option Format . . . . . . . . . . . . .10
  47.    3.1.1     Option Class . . . . . . . . . . . . . . . . . .  10
  48.    3.1.2     Type . . . . . . . . . . . . . . . . . . . . . .  10
  49.    3.1.3     Format . . . . . . . . . . . . . . . . . . . . .  11
  50.    3.2       Metrics and Options  . . . . . . . . . . . . . .  11
  51.    3.2.1     Distance . . . . . . . . . . . . . . . . . . . .  12
  52.    3.2.2     Delay  . . . . . . . . . . . . . . . . . . . . .  12
  53.    3.2.3     MTU  . . . . . . . . . . . . . . . . . . . . . .  12
  54.    3.2.4     Bandwidth  . . . . . . . . . . . . . . . . . . .  12
  55.  
  56.  
  57.  
  58. Ullmann                                                         [Page 1]
  59.  
  60. RFC 1476                          RAP                          June 1993
  61.  
  62.  
  63.    3.2.5     Origin . . . . . . . . . . . . . . . . . . . . .  12
  64.    3.2.6     Target . . . . . . . . . . . . . . . . . . . . .  13
  65.    3.2.7     Packet Cost  . . . . . . . . . . . . . . . . . .  13
  66.    3.2.8     Time Cost  . . . . . . . . . . . . . . . . . . .  13
  67.    3.2.9     Source Restriction . . . . . . . . . . . . . . .  14
  68.    3.2.10    Destination Restriction  . . . . . . . . . . . .  14
  69.    3.2.11    Trace  . . . . . . . . . . . . . . . . . . . . .  14
  70.    3.2.12    AUP  . . . . . . . . . . . . . . . . . . . . . .  15
  71.    3.2.13    Public . . . . . . . . . . . . . . . . . . . . .  15
  72.    4.       Procedure   . . . . . . . . . . . . . . . . . . .  15
  73.    4.1       Receiver filtering . . . . . . . . . . . . . . .  16
  74.    4.2       Update of metrics and options  . . . . . . . . .  16
  75.    4.3       Aggregation  . . . . . . . . . . . . . . . . . .  17
  76.    4.4       Active route selection . . . . . . . . . . . . .  17
  77.    4.5       Transmitter filtering  . . . . . . . . . . . . .  17
  78.    4.6       Last resort loop prevention  . . . . . . . . . .  18
  79.    5.       Conclusion  . . . . . . . . . . . . . . . . . . .  18
  80.    6.       Appendix: Real Number Representation  . . . . . .  19
  81.    7.       References  . . . . . . . . . . . . . . . . . . .  20
  82.    8.       Security Considerations . . . . . . . . . . . . .  20
  83.    9.       Author's Address  . . . . . . . . . . . . . . . .  20
  84.  
  85. 1.  Introduction
  86.  
  87.    RAP is a general protocol for distributing routing information at all
  88.    levels of the Internet, from private LANs to the widest-flung
  89.    international carrier networks.  It does not distinguish between
  90.    "interior" and "exterior" routing (except as restricted by specific
  91.    policy), and therefore is not as restricted nor complex as those
  92.    protocols that have strict level and area definitions in their
  93.    models.
  94.  
  95.    The protocol encourages the widest possible dissemination of topology
  96.    information, aggregating it only when limits of thrust, bandwidth, or
  97.    administrative policy require it.  Thus RAP permits aggressive use of
  98.    resources to optimize routes where desired, without the restrictions
  99.    inherent in the simplifications of other models.
  100.  
  101.    While RAP uses IPv7 [RFC1475] addressing internally, it is run over
  102.    both IPv4 and IPv7 networks, and shares routing information between
  103.    them.  A IPv4 router will only be able to activate and propagate
  104.    routes that are defined within the local Administrative Domain (AD),
  105.    loading the version 4 subset of the address into the local IP
  106.    forwarding database.
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114. Ullmann                                                         [Page 2]
  115.  
  116. RFC 1476                          RAP                          June 1993
  117.  
  118.  
  119. 1.1  Link-State and Distance-Vector
  120.  
  121.    Of the two major classes of routing algorithm, link-state and
  122.    distance vector, only distance vector seems to scale from the local
  123.    network (where RIP is existence-proof of its validity) to large scale
  124.    inter-domain policy routing, where the number of links and policies
  125.    exceeds the ability of each router to map the entire network.
  126.  
  127.    In between, we have OSPF, an open link state (specifically, using
  128.    shortest-path-first analysis of the graph, hence the acronym)
  129.    protocol, with extensive development in intra-area routing.
  130.  
  131.    Since distance vector has proven useful at both ends of the range, it
  132.    seems reasonable to apply it to the entire range of scales, creating
  133.    a protocol that works automatically on small groups of LANs, but can
  134.    apply fairly arbitrary policy in the largest networks.
  135.  
  136.    This helps model the real world, where networks are not clearly
  137.    divided into hierarchical domains with identifiable "border" routers,
  138.    but have many links across organizational structure and over back
  139.    fences.
  140.  
  141. 1.2  Terminology
  142.  
  143.    The RAP protocol propagates routes in the opposite direction to the
  144.    travel of datagrams using the routes.  To avoid confusion explaining
  145.    the routing protocol, several terms are distinguished:
  146.  
  147.    source          where datagrams come from, the source of the
  148.                    datagrams
  149.  
  150.    destination     where datagrams go to, the destination of the
  151.                    datagrams
  152.  
  153.    origin          where routing information originates, the router
  154.                    initially inserting route information into the
  155.                    RAP domain
  156.  
  157.    target          where routing information goes, the target uses the
  158.                    information to send datagrams
  159.  
  160. 1.3  Philosophy
  161.  
  162.    Protocols should become simpler as they evolve.
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170. Ullmann                                                         [Page 3]
  171.  
  172. RFC 1476                          RAP                          June 1993
  173.  
  174.  
  175. 2.  RAP Protocol
  176.  
  177.    The RAP protocol operates on TCP port 38, with peers opening a
  178.    symmetric TCP connection between the RAP ports on each system.  Thus
  179.    only one RAP connection exists between any pair of peers.
  180.  
  181.    RAP is also used on UDP port 38, as a peer discovery method.  Hosts
  182.    (i.e., non-routing systems) may listen to RAP datagrams on this port
  183.    to discover local gateways.  This is in addition to, or in lieu of,
  184.    an Internet Standard gateway discovery protocol, which does not exist
  185.    at this writing.
  186.  
  187.    The peers then use RAP commands to send each other all routes
  188.    available though the sending peer.  This occurs as a full-duplex
  189.    (i.e., simultaneous) exchange of information, with no acknowledgement
  190.    of individual commands.
  191.  
  192.    Once the initial exchange has been completed, the peers send only
  193.    updates to routes, new routes, and purge commands to delete routes
  194.    previously offered.
  195.  
  196.    When the connection is broken, each system purges all routes that had
  197.    been offered by the peer.
  198.  
  199. 2.1  Command Header Format
  200.  
  201.    Each RAP command starts with a header.  The header contains a length
  202.    field to identify the start of the next packet in the TCP stream, a
  203.    version number, and the code for the command.  On UDP, the length
  204.    field does not appear:  each UDP datagram must contain exactly one
  205.    RAP command and not contain data or padding after the end of the
  206.    command.
  207.  
  208.      0                   1                   2                   3
  209.      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  210.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  211.     |        length                                                 |
  212.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  213.     |        RAP version            |       command code            |
  214.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  215.  
  216. 2.1.1  Length field
  217.  
  218.    The length is a 32 bit unsigned number specifying the offset in bytes
  219.    from the first byte of the length field of this command packet to the
  220.    start of the length field of the next.  The minimum value is 8.
  221.    There is no specific limit to the length of a command packet;
  222.    implementations MUST be able to at least count and skip over a packet
  223.  
  224.  
  225.  
  226. Ullmann                                                         [Page 4]
  227.  
  228. RFC 1476                          RAP                          June 1993
  229.  
  230.  
  231.    that is too large and then MAY send an error indication.
  232.  
  233.    Each version of the protocol will profile what size should be
  234.    considered the limit for senders, and what (larger) size should be
  235.    considered by receivers to mean that the connection is insane:
  236.    either unsynchronized or worse.
  237.  
  238.    For version 1 of the protocol, senders MUST NOT send command packets
  239.    greater than 16384 bytes.  Receivers SHOULD consider packets that
  240.    appear to be greater than 162144 bytes in length to be an indication
  241.    of an unrecoverable error.
  242.  
  243.    Note that these limits probably will not be approached in normal
  244.    operation of version 1 of the protocol; receivers may reasonably
  245.    decline to use routes described by 16K bytes of metrics and policy.
  246.    But even the most memory-restricted implementation MUST be able to
  247.    skip such a command packet.
  248.  
  249. 2.1.2  RAP version
  250.  
  251.    The version field is a 16 bit unsigned number.  It identifies the
  252.    version of RAP used for that command.  Note that commands with
  253.    different versions may be mixed on the same connection, although the
  254.    usual procedure will be to do the serious protocol (exchanging route
  255.    updates) only at the highest version common to both ends of the
  256.    connection.
  257.  
  258.    Each side starts the connection by sending a poll command, using the
  259.    highest version supported and continues by using the highest version
  260.    received in any command from the remote.  The response to the poll
  261.    will either be a no-operation packet at that version or an error
  262.    packet at the highest version supported by the remote.
  263.  
  264.    This document describes version 1 of the RAP protocol.
  265.  
  266. 2.2  RAP Commands
  267.  
  268.    There five simple RAP commands, described in the following sections.
  269.  
  270. 2.2.1  No operation
  271.  
  272.    The no operation command serves to reset the poll timer (see next
  273.    section) of the receiver, or (as a side effect) to tell the receiver
  274.    that a particular version is supported.  It never contains option
  275.    specific data and its length is always 8.
  276.  
  277.    The no operation command is also used in a UDP broadcast to inform
  278.    other systems that the sender is running RAP actively on the network
  279.  
  280.  
  281.  
  282. Ullmann                                                         [Page 5]
  283.  
  284. RFC 1476                          RAP                          June 1993
  285.  
  286.  
  287.    and is both a possible gateway and a candidate peer.  If this command
  288.    is being sent in response to a broadcast poll, it should be sent only
  289.    to the poller.
  290.  
  291.    A RAP process may send such broadcasts in a startup sequence, or it
  292.    may persist indefinitely to inform other systems coming on line.  If
  293.    it persists, it must not send them more than once every 10 minutes
  294.    (after the initial startup sequence).  If the RAP process sends polls
  295.    as part of its startup, it must not persist in sending them after the
  296.    startup sequence.
  297.  
  298.    The command code for no-operation is always 0, regardless of RAP
  299.    version.
  300.  
  301. 2.2.2  Poll
  302.  
  303.    A poll command packet requests that the other side transmit either a
  304.    no-operation packet, or some other packet if sent without delay.
  305.    (i.e., receivers MUST NOT delay a response to a poll by waiting for
  306.    some other packet expected to be queued soon.)
  307.  
  308.    The poll command code is always 1, regardless of version, and the
  309.    length is always 8.
  310.  
  311.    Each RAP implementation runs a timer for each connection, to ensure
  312.    that if the other system becomes unreachable, the connection will be
  313.    closed or reset.  The timers run at each end of the connection are
  314.    independent; each system is responsible for sending polls in time to
  315.    reset its own timer.
  316.  
  317.    The timer MUST be reset (restarted) on the receipt of any RAP packet,
  318.    regardless of whether the version or command code is known.
  319.  
  320.    In normal operation, if route updates are being sent in both
  321.    directions, polls may not be necessary for long periods of time as
  322.    the timers are continually reset.  When the connection is quiescent,
  323.    both timers will typically get reset as a result of the side with the
  324.    shorter timer doing a poll, and then getting a no-operation in
  325.    response.  RAP implementations MUST NOT be dependent in any way on
  326.    the size or existence of the remote timer.
  327.  
  328.    An implementation that has access to information from the TCP layer,
  329.    such as the results of TCP layer keepalives, MAY use this instead of
  330.    or in addition to a timer.  However, the use of TCP keepalives is
  331.    discouraged, and this procedure does not ensure that the remote RAP
  332.    process is alive, only that its TCP is accepting data.  Thus a
  333.    failure mode exists that would not exist for active RAP layer polls.
  334.  
  335.  
  336.  
  337.  
  338. Ullmann                                                         [Page 6]
  339.  
  340. RFC 1476                          RAP                          June 1993
  341.  
  342.  
  343.    The timer MUST be implemented, SHOULD be configurable in at least the
  344.    range 1 to 10 minutes on a per-peer basis, and MAY be infinite
  345.    (disabled) by explicit configuration.
  346.  
  347.    On UDP, a system (router or non-routing host) may send RAP polls to
  348.    attempt to locate candidate peers or possible gateways.  Such a
  349.    system must not persist in sending polls after its startup sequence,
  350.    except that a system which actually has offered traffic for non-local
  351.    destinations, and has no available gateways, may continue to send
  352.    periodic polls to attempt to acquire a gateway.
  353.  
  354. 2.2.3  Error
  355.  
  356.    The error packet is used to report an error, whether fatal, serious
  357.    or informational.  It includes a null terminated text description in
  358.    ISO-10646-UTF-1 of the condition, which may be useful to a human
  359.    administrator, and SHOULD be written to a log file.  (The machine is
  360.    not expected to understand the text.)
  361.  
  362.    Errors are actual failures (in the interpretation of the receiver) to
  363.    use the correct syntax and semantics of the RAP protocol itself, or
  364.    "failure" of the receiver to implement a version of the protocol.
  365.    Other conditions that may require action on the part of the peer
  366.    (such as purging a route) are given their own command codes.
  367.  
  368.      0                   1                   2                   3
  369.      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  370.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  371.     |        length                                                 |
  372.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  373.     |        RAP version (1)        |       command code (2)        |
  374.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  375.     |        error code (0)  [reserved]                             |
  376.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  377.     |        description                                            |
  378.     +                                                               +
  379.     |                       ...                                     |
  380.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  381.  
  382.    The RAP system receiving an Error packet MUST NOT regard it as fatal,
  383.    and close the connection or discard routes.  If the sending system
  384.    desires the condition to be fatal (unrecoverable), its proper action
  385.    is to close the connection.  This requirement is to prevent the kind
  386.    of failure mode demonstrated by hosts that killed off TCP connections
  387.    on the receipt of ICMP Host-Unreachable notifications, even when the
  388.    condition is transient.  We do not want to discourage the reporting
  389.    of errors, in the way that some implementations avoided sending ICMP
  390.    datagrams to deal with overly sensitive hosts.
  391.  
  392.  
  393.  
  394. Ullmann                                                         [Page 7]
  395.  
  396. RFC 1476                          RAP                          June 1993
  397.  
  398.  
  399.    An error packet MUST NOT be sent in response to something that is (or
  400.    might be) an error packet itself.  Subsequent versions of RAP should
  401.    keep the command code point (2) of the error packet.
  402.  
  403. 2.2.4  Add Route
  404.  
  405.    The add route command offers a route to the receiving peer.  As noted
  406.    later, it MUST be a route actually loaded into the forwarding
  407.    database of the offering peer at the time the add route is sent.
  408.  
  409.      0                   1                   2                   3
  410.      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  411.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  412.     |        length                                                 |
  413.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  414.     |        RAP version (1)        |       command code (3)        |
  415.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  416.     |        distance               |     (MBZ)     |     mask      |
  417.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  418.     |        destination network                                    |
  419.     +                                                               +
  420.     |                    ...                                        |
  421.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  422.     |        route identifier                                       |
  423.     +                                                               +
  424.     |                    ...                                        |
  425.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  426.     |        metrics and options    ....                            |
  427.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  428.  
  429.    The add route command describes a single offered route, with the
  430.    metrics and other options (such as policies) associated with the
  431.    route.
  432.  
  433.    Distance is a simple count of the hops to the RAP process (or other
  434.    routing process) that originated the route, incremented every time
  435.    the route is forwarded.  Its initial value may be greater than 1,
  436.    particularily for a route that is administratively configured to
  437.    aggregate routes for a large network or AD.  It may also enter the
  438.    RAP routing domain for the first time with a non-zero distance
  439.    because the route originated in RIP, OSPF, or BGP; if so, the
  440.    distance carried in that protocol is copied into the RAP route.
  441.  
  442.    The mask is a count of the number of bits of prefix ones in the
  443.    binary representation of the network mask.  Non-contiguous masks are
  444.    not supported directly.  (The destination restriction option may be
  445.    used to give another, non-contiguous, mask; the header mask would
  446.    then describes the number of contiguous ones.)
  447.  
  448.  
  449.  
  450. Ullmann                                                         [Page 8]
  451.  
  452. RFC 1476                          RAP                          June 1993
  453.  
  454.  
  455.    The route identifier is a 64 bit value that the IP forwarding module
  456.    on the sending host can use to rapidly identify the route and the
  457.    next hop for each incoming datagram.  The host receiving the route
  458.    places this identifier into the forward route ID field of the
  459.    datagrams being sent to this host.
  460.  
  461.    The route ID is also used to uniquely identify the route in the purge
  462.    route operation.
  463.  
  464. 2.2.5  Purge Route
  465.  
  466.    The purge route command requires that the receiving peer delete a
  467.    route from its database if in use, and requires that it revoke that
  468.    route from any of its peers to whom it has offered the route.  This
  469.    command should preferably be sent before the route is deleted from
  470.    the sending peer's forwarding database, but this is not (cannot be)
  471.    required; it should be sent without delay when the route is removed.
  472.  
  473.    The command code is 4.  The format is the same as add route without
  474.    any added metrics or options.
  475.  
  476.    If the route identifier in a purge route command is zero, the command
  477.    requires the deletion of all routes to the destination previously
  478.    offered by this peer.
  479.  
  480. 3.  Attributes of Routes
  481.  
  482.    There are a rather large number of possible attributes.
  483.    Possibilities include both metrics, and other options describing for
  484.    example policy restrictions and alterations of proximity.  Any
  485.    particular route will usefully carry only a few attributes or none at
  486.    all, particularily on an infrastructure backbone.  A reasonable
  487.    policy for the routers that make up a backbone might be to strip all
  488.    attributes before propagating routes (discarding routes that carry
  489.    attributes with class indications prohibiting this), and then adding
  490.    (for example) an AUP attribute to all routes propagated off of the
  491.    backbone.  A less drastic method would be to simply prefer routes
  492.    with no restrictions, but still propagate a route with restrictions
  493.    if no other is available.
  494.  
  495.    Most options can occur more than once in a route if there is any
  496.    sensible reason to do so.
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506. Ullmann                                                         [Page 9]
  507.  
  508. RFC 1476                          RAP                          June 1993
  509.  
  510.  
  511. 3.1  Metric and Option Format
  512.  
  513.    Each metric or option for a route begins with a 32 bit header:
  514.  
  515.      0                   1                   2                   3
  516.      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  517.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  518.     |   length      | C |  format   |           type                |
  519.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  520.     |        option data                 ...        |   padding     |
  521.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  522.  
  523.                    RAP Option/Metric Header Format
  524.  
  525. A description of each field:
  526.  
  527.    length       length of the option or metric
  528.    C            option class, see below
  529.    format       data format
  530.    type         option type identifier
  531.    data         variable length
  532.  
  533. 3.1.1  Option Class
  534.  
  535.    This field tells implementations what to do with routes containing
  536.    options or metrics they do not understand.  No implementation is
  537.    required to implement (i.e., understand) any given option or metric
  538.    by the RAP specification itself, except for the distance metric in
  539.    the RAP header.
  540.  
  541.    Classes:
  542.  
  543.    0        use, propagate, and include this option unmodified
  544.    1        use, propagate, but do not include this option
  545.    2        use this route, but do not propagate it
  546.    3        discard this route
  547.  
  548.    Note that class 0 is an imperative:  if the route is propagated, the
  549.    option must be included.
  550.  
  551.    Class and type are entirely orthogonal, different implementations
  552.    might use different classes for the same option or metric.
  553.  
  554. 3.1.2  Type
  555.  
  556.    The type code identifies the specific option or metric.  The codes
  557.    are part of the option descriptions following.
  558.  
  559.  
  560.  
  561.  
  562. Ullmann                                                        [Page 10]
  563.  
  564. RFC 1476                          RAP                          June 1993
  565.  
  566.  
  567.    Type 0 indicates a null (no-operation) option.  It should be class
  568.    zero, but an implementation that "understands" the null option may
  569.    decline to propagate it.
  570.  
  571.    Note that since an implementation may delete an option of class 1 by
  572.    simply setting its type to 0 and forwarding the route description,
  573.    class 1 does not provide any confidentiality of the content of an
  574.    option.
  575.  
  576. 3.1.3  Format
  577.  
  578.    The format field specifies the format of the data included after the
  579.    option header.  Formats:
  580.  
  581.    0        none, no data present.
  582.    1        one or more 32-bit signed integers
  583.    2        a character string, null terminated
  584.    3        one or more real numbers
  585.    4        an octet string
  586.    5        one real, followed by a character string
  587.  
  588.    Format is also orthogonal to type, but a particular type is usually
  589.    only reasonably represented by one format.  This allows decoding of
  590.    all option values for logging and other troubleshooting, even when
  591.    the option type is unknown.  (A new unknown format will still present
  592.    a problem.)
  593.  
  594.    Format 4, octet string, is to be represented in dotted-decimal byte
  595.    form when printed; it is normally an internet address.
  596.  
  597.    Format 5 is intended for dimensioned parameters with the character
  598.    string giving the dimension or scale.
  599.  
  600. 3.2  Metrics and Options
  601.  
  602.    As much as possible, metrics are kept in the base units of bytes and
  603.    seconds, by analogy to the physics systems of MKS (meter-kilogram-
  604.    second) and CGS (centimeter-gram-second) of base units.
  605.  
  606.    Bytes aren't the real primitive, the bit is.  We are thus using a
  607.    multiple of 8 that isn't part of what one would come to expect from a
  608.    decimal metric system that uses the other prefixes.  However, since K
  609.    (kilo) is often taken to be 1024, and M (mega) to be 1,048,576 (or
  610.    even 1,024,000) we allow this liberty.
  611.  
  612.    Distance is measured in units also unique to the field.  It is the
  613.    integer number of times that a datagram must be forwarded to reach
  614.    the destination.  (Hop count.)
  615.  
  616.  
  617.  
  618. Ullmann                                                        [Page 11]
  619.  
  620. RFC 1476                          RAP                          June 1993
  621.  
  622.  
  623. 3.2.1  Distance
  624.  
  625.    The Distance metric counts the number of hops on a route; this is
  626.    included in the RAP route command header.
  627.  
  628.    The initial distance at insertion into the RAP domain by the origin
  629.    of the route MUST be less than or equal to 2z, where z is the number
  630.    of zero bits in the route mask.
  631.  
  632.    If the origin derives the route from RIP or OSPF, and the distance
  633.    exceeds 2z, the route must not be used.
  634.  
  635.    When a router originates a route designed to permit aggregation, the
  636.    distance is usefully set to more than 0; this allows simple subset
  637.    aggregation without propagating small distance changes repeatedly as
  638.    the internal diameter of the described network changes.
  639.  
  640.    For example, for routers designated to announce a default route for
  641.    an AD, with a 24/48 mask, the maximum initial distance is 96.
  642.  
  643. 3.2.2  Delay
  644.  
  645.    The Delay metric (Type = 2) measures the one-way path delay.  It is
  646.    usually the sum of delays configured for the gateways and interfaces,
  647.    but might also include path segments that are actually measured.
  648.  
  649.    Format is real (3), with one value.  The units are seconds.
  650.  
  651. 3.2.3  MTU
  652.  
  653.    The MTU metric (Type = 3) measures the minimum value over the route
  654.    of the Maximum Transmission Unit, i.e., the largest IP datagram that
  655.    can be routed without resulting in fragmentation.
  656.  
  657.    Format is one integer, measuring the MTU in bytes.
  658.  
  659. 3.2.4  Bandwidth
  660.  
  661.    The Bandwidth metric (Type = 4) measures the minimum bandwidth of the
  662.    path segments that make up the route.
  663.  
  664.    Format is one real, representing bandwidth in bytes/second.
  665.  
  666. 3.2.5  Origin
  667.  
  668.    The origin attribute (type = 5) identifies the router that originally
  669.    inserted the route into the RAP domain.  It is one of the IP
  670.    addresses of the router, format is 4.
  671.  
  672.  
  673.  
  674. Ullmann                                                        [Page 12]
  675.  
  676. RFC 1476                          RAP                          June 1993
  677.  
  678.  
  679. 3.2.6  Target
  680.  
  681.    The target attribute (type = 6) identifies a host or network toward
  682.    which the route should be propagated, regardless of proximity
  683.    filtering that would otherwise occur.  This aids in the establishment
  684.    of tunnels for hosts or subnets "away from home." It can be used to
  685.    force the route to propagate all the way to the home network, or to
  686.    try to propagate a better route to a host that the origin has
  687.    established a connection (e.g., TCP) with.  Note that a router can
  688.    distinguish these two cases during proximity filtering by comparing
  689.    the route described with the host or network identified by the target
  690.    option.
  691.  
  692.    Format is 4.
  693.  
  694. 3.2.7  Packet Cost
  695.  
  696.    The packet cost metric (type = 7) measures the actual cost (to
  697.    someone) of sending data over the route.  It is probably either class
  698.    3 or 0.  Format is 5.
  699.  
  700.    The real number is the cost in currency units/byte.  Tariffs set in
  701.    packets or "segments" should be converted using the nominal (or
  702.    actual path) size.  For example, Sprintnet charges for DAF
  703.    connections within its network are US$1.40/Ksegment thus for segments
  704.    of 64 bytes, the cost is 0.000021875 USD.
  705.  
  706.    The string is the 3 capital letter ISO code [ISO4217] for the
  707.    currency used.  Funds codes and codes XAU, XBA, XBB, XBC, XBD, and
  708.    XXX are not used.
  709.  
  710.    If a route already has a packet cost in a different currency
  711.    associated with it, another instance of this option should be added.
  712.    RAP implementations MUST NOT attempt to convert the currency units
  713.    except when actually making a route selection decision.  That is, the
  714.    effects of a currency conversion should never be propagated, except
  715.    for the proper effect of such a selection decision.
  716.  
  717. 3.2.8  Time Cost
  718.  
  719.    The time cost metric (type = 8) measures the actual cost of holding
  720.    one or more paths in the route open to send data.  It is probably
  721.    either class 3 or 0.  Format is 5.
  722.  
  723.    The real number is the cost in currency units/second.  For example,
  724.    Sprintnet charges for international connections (to typical
  725.    destinations) are US$10/hour so the cost is 0.002777778 USD.
  726.  
  727.  
  728.  
  729.  
  730. Ullmann                                                        [Page 13]
  731.  
  732. RFC 1476                          RAP                          June 1993
  733.  
  734.  
  735.    The other notes re codes used and conversions in the previous section
  736.    also apply.
  737.  
  738. 3.2.9  Source Restriction
  739.  
  740.    A source restriction option (type 9, format 4, class 2 or 3)
  741.    indicates that a route may only be used by datagrams from a
  742.    particular source or set of sources.  The data consists of a network
  743.    or host number, and a mask to qualify it.  If multiple source
  744.    restriction options are included, the restriction is the logical
  745.    union of the sources specified; i.e., any are permitted.
  746.  
  747.    Source restrictions must be added to routes when the RAP system has
  748.    security filters set in the IP forwarding layer.  This is necessary
  749.    to prevent datagrams from taking "better" routes that end in the
  750.    datagram being silently discarded at the filter.  Note that this
  751.    propagates confidential information about the security configuration,
  752.    but only toward the net authorized to use the route if the RAP
  753.    implementation is careful about where it is propagated.
  754.  
  755. 3.2.10  Destination Restriction
  756.  
  757.    A destination restriction option (type 10, format 4, class 3) serves
  758.    only to provide a non-contiguous mask, the destination already having
  759.    been specified in the command header.  Data is the destination
  760.    network and mask.
  761.  
  762. 3.2.11  Trace
  763.  
  764.    Trace (type 11, format 4, class 0) provides an indication that the
  765.    route has propagated through a particular system.  This can be used
  766.    for loop detection, as well as various methods of troubleshooting.
  767.    The data is one internet address, one of the addresses of the system.
  768.    If an arriving route already carries a trace identifying this system,
  769.    and is not an update, it is discarded.  If it is an update, the route
  770.    is purged.
  771.  
  772.    Trace SHOULD NOT be simply added to every route traversing a system.
  773.    Rather, it should be added (if being used for loop detection) when
  774.    there is a suspicion that a loop has formed.
  775.  
  776.    When the distance to a destination has increased twice in a row in a
  777.    fairly short period of time, and the number of trace options present
  778.    in the route did not increase as a result of the last update, the RAP
  779.    process should add a trace option identifying itself to the route.
  780.    Effectively, when a loop forms, one router will select itself to be a
  781.    tracer, adding itself and breaking the loop after one more turn.  If
  782.    that fails for some reason, another router will add its trace.  Each
  783.  
  784.  
  785.  
  786. Ullmann                                                        [Page 14]
  787.  
  788. RFC 1476                          RAP                          June 1993
  789.  
  790.  
  791.    router thus depends in the end only on its own trace and will break
  792.    the loop, even if the other routers are using other methods, or
  793.    simply counting-out the route.
  794.  
  795. 3.2.12  AUP
  796.  
  797.    The AUP (Acceptable Use Policy) option (type 12, format 2, class
  798.    any), tags a route as being useable only according to the policy of a
  799.    network.  This may be used to avoid traversal of the net by (for
  800.    example) commercial traffic, or to prevent un-intentional use of an
  801.    organization's internal net.  (It does not provide a security barrier
  802.    in the sense of forwarding filters, but does provide cooperative
  803.    exchange of information on the useability of a net.)
  804.  
  805.    The data is a domain name, probably the name of the network, although
  806.    it may be the name of another organization.  E.g., the routers that
  807.    are subject to the NSF AUP might add NSF.NET as the descriptor of
  808.    that policy.
  809.  
  810. 3.2.13  Public
  811.  
  812.    Public (type 13, format 0, class 2 or 3) marks the route as
  813.    consisting in part of a public broadcast medium.  Examples of a
  814.    public medium are direct radio broadcast or a multi-drop cable in
  815.    which other receivers, not associated with the destination may read
  816.    the traffic.  I.e., a TV cable is a public medium, a LAN within an
  817.    organization is not, even if it can be easily wiretapped.
  818.  
  819.    This is intended for use by cable TV providers to identify routes
  820.    that should not be used for private communications, in spite of the
  821.    attractively high bandwidth being offered.
  822.  
  823. 4.  Procedure
  824.  
  825.    Routing information arrives in the RAP process from other peers, from
  826.    (local) static route and interface configuration, and from other
  827.    protocols (e.g., RIP).  The RAP process filters out routes that are
  828.    of no interest (too detailed or too "far away" in the topology) and
  829.    builds an internal database of available routes.
  830.  
  831.    From this database, it selects routes that are to be active and loads
  832.    them into the IP forwarding database.
  833.  
  834.    It then advertises those routes to its peers, at a greater distance.
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842. Ullmann                                                        [Page 15]
  843.  
  844. RFC 1476                          RAP                          June 1993
  845.  
  846.  
  847.    -------------------------------------------------------------------
  848.  
  849.            [incoming routes]
  850.                    |
  851.                    v
  852.            [proximity filtering/aggregation]       [static routes]
  853.                    |                                  |
  854.                    v                                  v
  855.            [route database]  --->  [selected active routes]
  856.                    ^                       |
  857.                    |                       v
  858.            [RIP, etc. routes]      [output filtering]
  859.                                            |
  860.                                            v
  861.                                    [routes advertised]
  862.  
  863.    -------------------------------------------------------------------
  864.  
  865. 4.1  Receiver filtering
  866.  
  867.    The first step is to filter out offered routes that are too "far
  868.    away" or too specific.  The filter consists of a maximum distance at
  869.    which a route is considered usable for each possible (contiguous)
  870.    mask.
  871.  
  872.    Routers that need universal connectivity must either pass through the
  873.    filter all routes regardless of distance (short of "infinity"), and
  874.    use aggregation to reduce them, or have a default route to a router
  875.    that does this.
  876.  
  877.    The filter may be adjusted dynamically to fit limited resources, but
  878.    if the filter is opened, i.e., made less restrictive, there may be
  879.    routes that have already been offered and discarded that will never
  880.    become available.
  881.  
  882. 4.2  Update of metrics and options
  883.  
  884.    The process then updates any metrics present on the route to reflect
  885.    the path to the RAP peer.  MTU and bandwidth are minimized, delay and
  886.    cost are added in.  Distance is incremented.  Any unknown options
  887.    cause class-dependent processing:  discarding the option (class 2) or
  888.    route (3), or marking the route as non-propagatable (1).
  889.  
  890.    Policy options that are known may cause the route to be discarded at
  891.    this stage.
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898. Ullmann                                                        [Page 16]
  899.  
  900. RFC 1476                          RAP                          June 1993
  901.  
  902.  
  903. 4.3  Aggregation
  904.  
  905.    The next step is to aggregate routes that are subsetted by other
  906.    routes through the same peer.  This should not be done automatically
  907.    in every possible case.  The more information that is propagated, the
  908.    more effective the use of forward route identifiers is likely to be,
  909.    particularily in the case of aggregating into a default route.
  910.  
  911.    In general, a route can be included in an aggregate, and not
  912.    propagated further, if it is through the same peer (next hop) and has
  913.    a smaller distance metric than the containing route.  (Thus datagrams
  914.    will always travel "downhill" as they take more specific routes.)
  915.  
  916.    The usual case of aggregation is that routes derived from interface
  917.    configurations on the routers from which they originated are subsumed
  918.    into routes offered by routers explicitly configured to route for an
  919.    entire network, area, or AD.  If the larger area becomes partitioned,
  920.    unaggregatable routes will appear (as routes outside the area become
  921.    the shortest distance routes) and traffic will flow around the
  922.    partition.
  923.  
  924.    Attributes of routes, particularily policy options, may prevent
  925.    aggregation and may result in routes simply being discarded.
  926.  
  927.    Some information about aggregation also needs to be represented in
  928.    the forwarding database, if the route is made active:  the router
  929.    will need to make a decision as to which forward route identifier to
  930.    use for each datagram arriving on the active route.
  931.  
  932. 4.4  Active route selection
  933.  
  934.    The router selects those routes to be entered into the IP forwarding
  935.    database and actively used to forward datagrams from the set of
  936.    routes after aggregation, combined with routes derived from other
  937.    protocols such as RIP.  This selection may be made on any combination
  938.    of attributes and options desired by local policy.
  939.  
  940. 4.5  Transmitter filtering
  941.  
  942.    Finally, the RAP process must decide which routes to offer to its
  943.    peers.  These must be a subset of the active routes, and may in turn
  944.    be a selected subset for each peer.  Arbitrary local policies may be
  945.    used in deciding whether or not to offer any particular route to a
  946.    given peer.
  947.  
  948.    However, the transmitter must ensure that any datagram filters are
  949.    represented in the offered route, so that the peer (and its peers)
  950.    will not route into a black hole.
  951.  
  952.  
  953.  
  954. Ullmann                                                        [Page 17]
  955.  
  956. RFC 1476                          RAP                          June 1993
  957.  
  958.  
  959. 4.6  Last resort loop prevention
  960.  
  961.    RAP is designed to support many different kinds of routing selection
  962.    algorithms, and allow them to interact to varying extents.  Routes
  963.    can be shared among administrations, and between systems managed with
  964.    more or less sophistication.
  965.  
  966.    This leaves one absolute requirement:  routing loops must be self-
  967.    healing, regardless of the algorithm used on each host.  There are
  968.    two caveats:
  969.  
  970.      1.  A loop will not fix itself in the presence of an error that
  971.          continually recurs (thus re-generating the loop)
  972.  
  973.      2.  The last resort algorithm does not provide rapid breaking of
  974.          loops, only eventual breaking of them even in the absence of
  975.          any intervention by (human) intelligence.
  976.  
  977.    The algorithm relies on the distance in the RAP route header.  This
  978.    count must be updated (i.e., incremented by one) at each router
  979.    forwarding the route.
  980.  
  981.    Routers must also impose some limit on the number of hops permitted
  982.    in incoming routes, discarding any routes that exceed the limit.
  983.    This limit is "infinity" in the classic algorithm.  In RIP, infinity
  984.    is 15, much too low for general inter-domain routing.
  985.  
  986.    In RAP, infinity is defined as 2z + i, where z is the number of zero
  987.    bits in the mask (as described previously) and i is a small number
  988.    which MUST be configurable.
  989.  
  990.    Note that RAP depends on the last resort algorithm, "counting to
  991.    infinity," much less than predecessors such as RIP.  Routes in the
  992.    RAP domain will usually be purged from the net as the purge route
  993.    command is flooded without the delays typical of periodic broadcast
  994.    algorithms.  Only in some cases will loops form, and they will be
  995.    counted out as fast as the routing processes can exchange the
  996.    information.
  997.  
  998. 5.  Conclusion
  999.  
  1000.    Unlike prior routing protocols, RAP is designed to solve the entire
  1001.    problem, from hands-off autoconfiguration of LAN networks, to
  1002.    implementing the most complex policies of international carriers.  It
  1003.    provides a scaleable solution to carry the Internet forward to a
  1004.    future in which essentially all users of data transmission use IP as
  1005.    the fabric of their networks.
  1006.  
  1007.  
  1008.  
  1009.  
  1010. Ullmann                                                        [Page 18]
  1011.  
  1012. RFC 1476                          RAP                          June 1993
  1013.  
  1014.  
  1015. 6.  Appendix:  Real Number Representation
  1016.  
  1017.    Real numbers are represented by a one byte exponent, e, in excess-128
  1018.    notation, and a fraction, f, in excess-8388608 notation, with the
  1019.    radix point at the right.  (I.e., the "fraction" is actually an
  1020.    integer.)
  1021.  
  1022.    e is thus in the range 0 to 255, representing exponents (powers of 2)
  1023.    in the range 2^-128 to 2^127.
  1024.  
  1025.    f is in the range 0 to 16777215, representing numbers from -8388608
  1026.    to 8388607
  1027.  
  1028.    The value is (f-8338608) x 2^(e-128)
  1029.  
  1030.    The real number is not necessarily normalized, but a normalized
  1031.    representation will, of course, provide more accuracy for numbers not
  1032.    exactly representable.
  1033.  
  1034.    Example code, in C:
  1035.  
  1036.    #include <math.h>
  1037.  
  1038.    typedef struct {
  1039.            unsigned e : 8;
  1040.            unsigned f : 24;
  1041.            } real;
  1042.  
  1043.    double a;          /* input value */
  1044.    real r;
  1045.    double b;          /* output value */
  1046.    double d;
  1047.    int e32;
  1048.  
  1049.    /* convert to real: */
  1050.  
  1051.    d = frexp(a, &e32);
  1052.    r.e = e32+105;
  1053.    r.f = (int)(d*8388608.0) + 8388608;
  1054.  
  1055.    /* convert back: */
  1056.  
  1057.    b = ldexp((double)r.f - 8388608.0, (int)r.e - 128);
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066. Ullmann                                                        [Page 19]
  1067.  
  1068. RFC 1476                          RAP                          June 1993
  1069.  
  1070.  
  1071. 7.  References
  1072.  
  1073.    [ISO3166]   International Organization for Standardization.  Codes
  1074.                for the Representation of Names of Countries.  ISO
  1075.                3166, ISO, 1988.
  1076.  
  1077.    [ISO4217]   International Organization for Standardization.  Codes
  1078.                for the representation of currencies and funds.  ISO
  1079.                4217, ISO, 1981.
  1080.  
  1081.    [RFC791]    Postel, J., "Internet Protocol - DARPA Internet Program
  1082.                Protocol Specification", STD 5, RFC 791, DARPA,
  1083.                September 1981.
  1084.  
  1085.    [RFC1058]   Hedrick, C., "Routing Information Protocol", STD 34,
  1086.                RFC 1058, Rutgers University, June 1988.
  1087.  
  1088.    [RFC1247]   Moy, J., "OSPF Version 2", RFC 1247, Proteon, Inc.,
  1089.                July 1991.
  1090.  
  1091.    [RFC1287]   Clark, D., Chapin, L., Cerf, V., Braden, R., and
  1092.                R. Hobby, "Towards the Future Internet Architecture",
  1093.                RFC 1287, MIT, BBN, CNRI, ISI, UCDavis, December 1991.
  1094.  
  1095.    [RFC1338]   Fuller, V., Li, T., Yu, J., and K. Varadhan,
  1096.                "Supernetting: an Address Assignment and Aggregation
  1097.                Strategy", RFC 1338, BARRNet, cicso, Merit, OARnet,
  1098.                June 1992.
  1099.  
  1100.    [RFC1475]   Ullmann, R., "TP/IX: The Next Internet", RFC 1475,
  1101.                Process Software Corporation, June 1993.
  1102.  
  1103. 8.  Security Considerations
  1104.  
  1105.    Security issues are discussed in sections 3.2.9 and 3.2.12.
  1106.  
  1107. 9.  Author's Address
  1108.  
  1109.    Robert Ullmann
  1110.    Process Software Corporation
  1111.    959 Concord Street
  1112.    Framingham, MA 01701
  1113.    USA
  1114.  
  1115.    Phone: +1 508 879 6994 x226
  1116.    Email: Ariel@Process.COM
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122. Ullmann                                                        [Page 20]
  1123.